﻿@Html.Raw(Netnr.SharedApp.QuoteTo.Html("the"))
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <title>@ViewData["Title"]</title>

    @Html.Raw(Netnr.SharedApp.QuoteTo.Html("favicon,blog-seo,bootstrap.css,fa.css,jquery.js,bootstrap.js"))

    <link href="/areas/gist/css/global.css" rel="stylesheet" asp-append-version="true" />
</head>
<body>
    <partial name="_PartialQuote" model="@("MirrorReadOnly")" />

    <nav class="navbar navbar-expand-md navbar-dark bg-dark">
        <a class="navbar-brand" href="/gist"><i class="fa fa-fw fa-file-code-o"></i> <b>@GlobalTo.GetValue("Common:EnglishName")</b> Gist</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#gistnavbar">
            <span class="navbar-toggler-icon"></span>
        </button>

        @{
            var hc = ViewContext.HttpContext;
            bool IsLogin = hc.User.Identity.IsAuthenticated;
            var currurl = hc.Request.Path;
            var hr = ViewContext.RouteData;
            var fa = $"{hr.Values["controller"].ToString()}/{hr.Values["action"].ToString()}".ToLower() == "user/index" ? currurl.ToString() : "/gist/discover";
        }

        <div class="collapse navbar-collapse" id="gistnavbar">
            <ul class="navbar-nav mr-auto">
                <li class="nav-item">
                    <form class="form-inline" action="@fa" method="get" id="gsearch">
                        <input class="form-control mr-sm-3 txtsearch" name="q" aria-label="Search" placeholder="Search..." value="@ViewData["q"]">
                    </form>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/gist/discover"><i class="fa fa-fw fa-file-text"></i>Discover</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/"><i class="fa fa-fw fa-home"></i>@GlobalTo.GetValue("Common:EnglishName")</a>
                </li>
            </ul>

            @if (IsLogin)
            {
                var uinfo = Netnr.Blog.Web.Apps.LoginService.Get(ViewContext.HttpContext);

                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link" href='/@ViewContext.RouteData.Values["area"].ToString().ToLower()'>
                            <i class="fa fa-plus"></i>
                        </a>
                    </li>
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown">
                            <i class="fa fa-user-circle"></i>
                        </a>
                        <div class="dropdown-menu dropdown-menu-right">
                            <h6 class="dropdown-header">
                                Signed in as <b>@uinfo.Nickname</b>
                            </h6>
                            <div class="dropdown-divider"></div>
                            <a class="dropdown-item" href="/gist/user/@uinfo.UserId"><i class="fa fa-fw fa-file-code-o"></i> Your gists</a>
                            <a class="dropdown-item" href="/user/id/@uinfo.UserId"><i class="fa fa-fw fa-user"></i> Your profile</a>
                            <div class="dropdown-divider"></div>
                            <a class="dropdown-item" href="/user/setting"><i class="fa fa-fw fa-cog"></i> Settings</a>
                            <a class="dropdown-item" href="/account/logout/gist"><i class="fa fa-fw fa-power-off"></i> Sign out</a>
                        </div>
                    </li>
                </ul>
            }
            else
            {
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link" href="/account/login?ReturnUrl=@currurl">
                            <i class="fa fa-user"></i> Sign
                        </a>
                    </li>
                </ul>
            }
        </div>
    </nav>

    <script>
        function htmlDecodeByRegExp(str) {
            if (str.length == 0) return "";
            return str.replace(/&lt;/g, "<")
                .replace(/&gt;/g, ">")
                .replace(/&nbsp;/g, " ")
                .replace(/&#39;/g, "\'")
                .replace(/&quot;/g, "\"")
                .replace(/&amp;/g, "&");
        }
    </script>

    @RenderBody()

    <partial name="_PartialFooter" />

    <a href="javascript:void(0);" onclick="$('html,body').animate({scrollTop:0}, 400)" class="totop" title="返回顶部">ˆ</a>

    <partial name="_PartialQuote" model="@("fun.js")" />
</body>
</html>